package cn.itcast.demo.service;

import cn.itcast.demo.dao.FakeDao;
import cn.itcast.demo.dao.UserFeignClient;
import cn.itcast.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: taft
 * @Date: 2018-12-9 11:48
 */
@Service
public class UserService {

    @Autowired
    private UserFeignClient userFeignClient;


    public List<User> queryUsersByIds(List<Long> ids) {


        List<User> userList = new ArrayList<>();

        ids.forEach(id->userList.add(userFeignClient.queryUserById(id)));
        return userList;
    }
}
